import React from 'react';
import {
  View,
  Text,
  StyleSheet,
  TextInput,
  Button,
} from 'react-native';
import {Actions} from 'react-native-router-flux';

export default class HomeScreen extends React.Component {
  clear() {
    console.log("clear...");
    this.refs.textInput.clear();
  }
  render() {
    return (
      <View style={styles.container}>
        <Text>首页</Text>
        <TextInput ref="textInput" style={styles.textInput} />
        <Button title="清空" onPress={() => this.clear()}/>
      </View>
    )
  }
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    justifyContent: 'center',
    alignItems: 'center',
    backgroundColor: '#f5fcff',
  },
  textInput: {
    width: "100%",
    padding: 10,
    margin: 15,
    borderColor: "gray",
    borderWidth: 1
  }
})
